package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ActivityItem;
import com.api.shopapi.entity.ActivityOrder;
import com.api.shopapi.mapper.ActivityOrderMapper;
import com.api.shopapi.service.ActivityOrderService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ActivityOrderServiceImplOne")
public class ActivityOrderServiceImpl implements ActivityOrderService {

    @Autowired
    private ActivityOrderMapper activityOrderMapper;

    @Override
    public
    int insert(ActivityOrder activityOrder){
        return activityOrderMapper.insert(activityOrder);
    }


    @Override
    public
    int delete(String activityOrderCode){
        return activityOrderMapper.delete(activityOrderCode);
    }


    @Override
    public
    int update(ActivityOrder activityOrder){
        return activityOrderMapper.update(activityOrder);
    }

    @Override
    public
    ActivityOrder getByActivityOrderCode(String activityOrderCode){
        return activityOrderMapper.getByActivityOrderCode(activityOrderCode);
    }


    @Override
    public
    PageInfo<ActivityOrder> PageByCommandCenterCode(int pageIndex, int pageSize,
                                                    String governmentCode, String commandCenterCode,int status){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityOrder> complaintList =activityOrderMapper.ListByCommandCenterCode(governmentCode,commandCenterCode,status);
        return new PageInfo<>(complaintList);
    }


    @Override
    public
    PageInfo<ActivityOrder> PageByPracticeSiteCode(int pageIndex, int pageSize, String practiceSiteCode,int status){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityOrder> complaintList =activityOrderMapper.ListByPracticeSiteCode(practiceSiteCode,status);
        return new PageInfo<>(complaintList);
    }


    @Override
    public
    PageInfo<ActivityOrder> PageByVolunteerTeamCode(int pageIndex, int pageSize, String volunteerTeamCode,int status){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityOrder> complaintList =activityOrderMapper.ListByVolunteerTeamCode(volunteerTeamCode,status);
        return new PageInfo<>(complaintList);
    }


}
